package com.simple.elpmobile.onlinecase.engine.network;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.text.TextUtils;

import com.iflytek.elpmobile.utils.StringUtils;

/**
 * 
 * @author jgzheng
 * @description:parse json data
 */

public abstract class JsonToInfo {/*
	
	public static UserInfo getUserInfoByJson(JSONObject jUserInfo) {
		UserInfo userInfo = new UserInfo();
		userInfo.setUserName(jUserInfo.optString("name"));

		int sex = 0;
		try {
			sex = Integer.parseInt(jUserInfo.optString("sex"));
		} catch (NumberFormatException e) {
			e.printStackTrace();
		} finally {
			userInfo.setUserSex(sex);
		}
		if ("null".equals(jUserInfo.optString("headimage"))) {
			userInfo.setUserHead("");
		} else {
			userInfo.setUserHead(jUserInfo.optString("headimage"));
		}

		if (!"null".equals(jUserInfo.optString("birthday"))
				&& !StringUtils.isEmpty(jUserInfo.optString("birthday"))) {
			userInfo.setUserBirthday(jUserInfo.optString("birthday"));
		}

		if (!"null".equals(jUserInfo.optString("grade"))
				&& !StringUtils.isEmpty(jUserInfo.optString("grade"))) {
			userInfo.setUserGrade(jUserInfo.optString("grade"));
		}

		if (!"null".equals(jUserInfo.optString("userid"))
				&& !StringUtils.isEmpty(jUserInfo.optString("userid"))) {
			userInfo.setUserId(jUserInfo.optString("userid"));
		}

		if (!"null".equals(jUserInfo.optString("email"))
				&& !StringUtils.isEmpty(jUserInfo.optString("email"))) {
			userInfo.setUserMail(jUserInfo.optString("email"));
		}
		if (!"null".equals(jUserInfo.optString("phone"))
				&& !StringUtils.isEmpty(jUserInfo.optString("phone"))) {
			userInfo.setUserPhone(jUserInfo.optString("phone"));
		}

		if (!"null".equals(jUserInfo.optString("loginType"))
				&& !StringUtils.isEmpty(jUserInfo.optString("loginType"))) {
			String userType = jUserInfo.optString("loginType");
			if (userType.equals("3rd")) {
				userInfo.setUserType(UserInfo.USER_TYPE_3RD);
			} else if (userType.equals("cycore")) {
				userInfo.setUserType(UserInfo.USER_TYPE_CYCORE);
			} else if (userType.equals("phone")) {
				userInfo.setUserType(UserInfo.USER_TYPE_PHONE);
			} else if (userType.equals("email")) {
				userInfo.setUserType(UserInfo.USER_TYPE_MAIL);
			}
		}

		return userInfo;

	}
*/}